<?php

namespace app\common\model;

use think\Model;

/**
 * 会员提现接口模型
 */
class Withdrawal Extends Model
{

    // 表名
    protected $name = 'user_withdrawal';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'state_text'
    ];


    public function getStateList()
    {
        return ['10' => __('Check pending'), '20' => __('Approved'), '30' => __('Approval rejection')];
    }


    public function getStateTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
        $list = $this->getStateList();
        return isset($list[$value]) ? $list[$value] : '';
    }

}
